﻿using System;

namespace Plan
{
    public class ReportProgressArgs : EventArgs
    {
        private readonly float? _progress;
        private readonly ScheduleSolution _bestSolution;
        private readonly ScheduleLogEntry _logEntry;
        bool _cancel = false;

        //public static readonly ReportProgressArgs Finished = new ReportProgressArgs(1, null);

        public ReportProgressArgs(float progress, ScheduleSolution bestSolution) : this(progress, bestSolution, new ScheduleLogEntry(""))
        {
        }

        public ReportProgressArgs(float progress, ScheduleLogEntry logEntry) : this(progress, logEntry.Solution, logEntry)
        {
        }
        public ReportProgressArgs(float progress, ScheduleSolution bestSolution, ScheduleLogEntry logEntry)
        {
            _progress = progress;
            _logEntry = logEntry;
            _bestSolution = bestSolution;
        }

        public bool SupportsProgress
        {
            get { return Progress != null; }
        }

        public double? Progress
        {
            get { return _progress; }
        }

        public ScheduleSolution BestSolution
        {
            get { return _bestSolution; }
        }

        public ScheduleLogEntry LogMessage
        {
            get { return _logEntry; }
        }

        public bool Cancel
        {
            get { return _cancel; }
            set { _cancel = value; }
        }
    }
}
